home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.c
- Subject: Re: malloc question
- Date: 12 Mar 1996 20:14:07 GMT
- Organization: Los Alamos National Laboratory
- Distribution: world
- Message-ID: <TANMOY.96Mar12131407@qcd.lanl.gov>
- References: <4htonk$350@news.hklink.net> <danpop.826488975@rscernix>
- <4i44vk$g16@rigel.rz.uni-ulm.de>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: peinel@faw.uni-ulm.de's message of 12 Mar 1996 15:24:36 GMT
-
- In article <4i44vk$g16@rigel.rz.uni-ulm.de>
- peinel@faw.uni-ulm.de (Gertraud Peinel) writes:
- <snip>
- GP: |> You DON'T have to cast the value returned by malloc, casting it is actually
- GP: |> a BAD idea. But you DO have to include <stdlib.h> in any source file
- GP: |> which calls malloc.
- GP:
- GP: Hmmm, and what should I do with this (especially when I have to use these
- GP: compilers) ? :
- GP:
- GP: sun5:/users/peinel/clang(36)> uname -a
- GP: SunOS sun5 4.1.3 3 sun4c
- GP: sun5:/users/peinel/clang(35)> cat oh.c
- GP: #include <stdlib.h>
- GP:
- GP: typedef struct item {
- GP: int val;
- GP: struct item *next;
- GP: } ITEM, *PITEM;
- GP:
- GP: main()
- GP: {
- GP: PITEM head, current;
- GP: head= malloc(sizeof(ITEM));
- GP: head->val=1;
- GP: }
- GP: sun5:/users/peinel/clang(29)> cc oh.c
- GP: "oh.c", line 11: warning: illegal pointer combination
- GP: sun5:/users/peinel/clang(34)> which cc
- GP: /bin/cc
- GP: sun5:/users/peinel/clang(32)> CC oh.c
- GP: CC mist.c:
- GP: "oh.c", line 11: error: no standard conversion of char * to struct item *
- GP: "oh.c", line 10: warning: current not used
- GP: 1 error
- GP: sun5:/users/peinel/clang(33)> which CC
- GP: /com/owc++/bin/CC
- GP:
- GP: Without casting ?
-
- Complain to the vendor that they have a misleading name for their
- program. Neither cc nor CC is a C compiler under either the current
- international standard meaning of that term.
-
- In the meantime, you can get an install the excellent free C compiler
- available for your platform. Commercial compilers for the language
- under discussion is also available for this particular platform.
-
- A suitable name for cc would probably be kr1c :-) I do not know what
- CC is.
-
- Cheers
- Tanmoy
-
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-